﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Syndication;
using System.IO;
using System.Xml;
using PBDesk.Business.FeedProvider;

namespace PBDesk.Web.CMS.pages
{
    /// <summary>
    /// Summary description for RSS
    /// </summary>
    public class RSS : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            SyndicationFeed feed = FeedManager.GetFeedsForPBDeskCOM(); 
            var output = new StringWriter(); 
            var writer = new XmlTextWriter(output); 
            new Rss20FeedFormatter(feed).WriteTo(writer); 
            context.Response.ContentType = "application/rss+xml"; 
            context.Response.Write(output.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}